#include "linuxheader.h"
#include <workflow/WFHttpServer.h>

static WFFacilities::WaitGroup  waitGrop(1);


void sigHandler(int num)
{
    waitGrop.done();
    fprintf(stderr,"waitGrop is done!\n");
}
void callBack(WFTimerTask *timerTask)
{
    struct timeval tv;
    gettimeofday(&tv,NULL);
    printf("callback %ld.%06ld\n",tv.tv_sec,tv.tv_usec);
    WFTimerTask *nextTask = WFTaskFactory::create_timer_task(2*1000000,callBack);
    series_of(timerTask)->push_back(nextTask);
}
int main()
{
    signal(SIGINT,sigHandler);
    //创建一个服务器对象；
WFTimerTask*timerTask= WFTaskFactory::create_timer_task(2*1000000,callBack);
 timerTask->start();
 struct timeval tv;
 gettimeofday(&tv,NULL);
 printf("main %ld.%06ld\n",tv.tv_sec,tv.tv_usec);
   waitGrop.wait();
   return 0;
}